<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>avalon: E:/avalon/src/libavalon/deliver.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">avalon
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search',false);
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_f51b14f5b402f75e5fe3fdf41b0bea7b.html">libavalon</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="headertitle"><div class="title">deliver.h</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span><span class="preprocessor">#ifndef DELIVER_H_</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno">    2</span><span class="preprocessor">#define DELIVER_H_</span></div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno">    3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno">    4</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno">    5</span><span class="preprocessor">#include &lt;mutex&gt;</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno">    6</span><span class="preprocessor">#include &lt;condition_variable&gt;</span></div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno">    7</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespace_f_l_a_g.html">FLAG</a></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno">   13</span>{</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"><a class="line" href="namespace_f_l_a_g.html#a4ed97ba12503ee6570c585e5df503c1d">   17</a></span>    <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code hl_variable" href="namespace_f_l_a_g.html#a4ed97ba12503ee6570c585e5df503c1d">OnlySend</a> = 0x1;</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno">   18</span>    </div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"><a class="line" href="namespace_f_l_a_g.html#a0fd6e9f0f6df94ff81429d14418c7e83">   22</a></span>    <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code hl_variable" href="namespace_f_l_a_g.html#a0fd6e9f0f6df94ff81429d14418c7e83">SendAndReceived</a> = 0x2;</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span>}</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span> </div>
<div class="foldopen" id="foldopen00029" data-start="{" data-end="};">
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"><a class="line" href="struct_reply.html">   29</a></span><span class="keyword">typedef</span> <span class="keyword">struct</span></div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno">   30</span>{</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"><a class="line" href="struct_reply.html#ad8ffcb6b7adb181557c1030fa0d8d6b0">   31</a></span>    <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code hl_variable" href="struct_reply.html#ad8ffcb6b7adb181557c1030fa0d8d6b0">data</a>; </div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"><a class="line" href="struct_reply.html#acbc2644b460b9a5bf39aaf7f7b54830d">   32</a></span>    <span class="keywordtype">int</span> <a class="code hl_variable" href="struct_reply.html#acbc2644b460b9a5bf39aaf7f7b54830d">size</a>;         </div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span>} <a class="code hl_struct" href="struct_reply.html">Reply</a>;</div>
</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span> </div>
<div class="foldopen" id="foldopen00039" data-start="{" data-end="};">
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"><a class="line" href="class_deliver.html">   39</a></span><span class="keyword">class </span><a class="code hl_class" href="class_deliver.html">Deliver</a></div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span>{</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span><span class="keyword">public</span>:</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno">   50</span>    <a class="code hl_function" href="class_deliver.html#a7bffed391626bd10d14c1bfad8d9e64e">Deliver</a>(<span class="keyword">const</span> std::string &amp;app_name, <span class="keyword">const</span> std::string &amp;sub_name, <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code hl_function" href="class_deliver.html#ab5ed5090feebd3f79364f7af311b5ea4">data</a>, <span class="keywordtype">int</span> <a class="code hl_function" href="class_deliver.html#ac38bf2ecd3e5e067eba29ee1e7bb7a26">size</a>, <span class="keywordtype">int</span> <a class="code hl_function" href="class_deliver.html#a31fe9e0abe81edde7602aae93962eaec">flag</a>);</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span> </div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span>    <span class="keyword">virtual</span> <a class="code hl_function" href="class_deliver.html#ac015d1cb31e71cb00732af2d683ff765">~Deliver</a>();</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno">   56</span> </div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span>    std::string <a class="code hl_function" href="class_deliver.html#a67c93117a9180e6f362b54db90d7240c">appName</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno">   62</span> </div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span>    std::string <a class="code hl_function" href="class_deliver.html#a629a3c50354b41bfda51533a667e102c">subName</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span> </div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span>    <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code hl_function" href="class_deliver.html#ab5ed5090feebd3f79364f7af311b5ea4">data</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span> </div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno">   79</span>    <span class="keywordtype">int</span> <a class="code hl_function" href="class_deliver.html#ac38bf2ecd3e5e067eba29ee1e7bb7a26">size</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno">   80</span> </div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno">   85</span>    <span class="keywordtype">int</span> <a class="code hl_function" href="class_deliver.html#a31fe9e0abe81edde7602aae93962eaec">flag</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno">   86</span> </div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno">   91</span>    <a class="code hl_struct" href="struct_reply.html">Reply</a> *<a class="code hl_function" href="class_deliver.html#a4f51513380c6255ecc8bea12593e9540">reply</a>();</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno">   92</span> </div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span>    <span class="keywordtype">bool</span> <a class="code hl_function" href="class_deliver.html#aad55d2243e358a5d397d7e3aff55c3db">isReplied</a>();</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span> </div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno">  103</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_deliver.html#a8fd1e1719e6f4784c6895e7762ac9002">setReplied</a>(<span class="keywordtype">bool</span> replied);</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno">  104</span> </div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno">  109</span>    std::mutex *<a class="code hl_function" href="class_deliver.html#a849c168dc7ff635842a2ef36f6d9d922">mutex</a>();</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno">  110</span> </div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno">  115</span>    std::condition_variable *<a class="code hl_function" href="class_deliver.html#a6b65097be32fcf618eac00f4aeaac818">cond</a>();</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno">  116</span> </div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno">  117</span><span class="keyword">private</span>:</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno">  118</span>    std::string app_name_;         </div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno">  119</span>    std::string sub_name_;         </div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno">  120</span>    <span class="keyword">const</span> <span class="keywordtype">char</span> *data_;             </div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno">  121</span>    <span class="keywordtype">int</span> size_;                     </div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno">  122</span>    <span class="keywordtype">int</span> flag_;                     </div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno">  123</span>    <a class="code hl_struct" href="struct_reply.html">Reply</a> reply_;                  </div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno">  124</span>    <span class="keywordtype">bool</span> is_reply_;                </div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno">  125</span>    std::mutex mutex_;             </div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno">  126</span>    std::condition_variable cond_; </div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno">  127</span>};</div>
</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno">  128</span> </div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno">  129</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="aclass_deliver_html"><div class="ttname"><a href="class_deliver.html">Deliver</a></div><div class="ttdoc">类，用于处理消息的投递。</div><div class="ttdef"><b>Definition</b> deliver.h:40</div></div>
<div class="ttc" id="aclass_deliver_html_a31fe9e0abe81edde7602aae93962eaec"><div class="ttname"><a href="class_deliver.html#a31fe9e0abe81edde7602aae93962eaec">Deliver::flag</a></div><div class="ttdeci">int flag() const</div><div class="ttdoc">获取标志。</div><div class="ttdef"><b>Definition</b> deliver.cpp:33</div></div>
<div class="ttc" id="aclass_deliver_html_a4f51513380c6255ecc8bea12593e9540"><div class="ttname"><a href="class_deliver.html#a4f51513380c6255ecc8bea12593e9540">Deliver::reply</a></div><div class="ttdeci">Reply * reply()</div><div class="ttdoc">获取回复。</div><div class="ttdef"><b>Definition</b> deliver.cpp:38</div></div>
<div class="ttc" id="aclass_deliver_html_a629a3c50354b41bfda51533a667e102c"><div class="ttname"><a href="class_deliver.html#a629a3c50354b41bfda51533a667e102c">Deliver::subName</a></div><div class="ttdeci">std::string subName() const</div><div class="ttdoc">获取订阅名称。</div><div class="ttdef"><b>Definition</b> deliver.cpp:18</div></div>
<div class="ttc" id="aclass_deliver_html_a67c93117a9180e6f362b54db90d7240c"><div class="ttname"><a href="class_deliver.html#a67c93117a9180e6f362b54db90d7240c">Deliver::appName</a></div><div class="ttdeci">std::string appName() const</div><div class="ttdoc">获取应用名称。</div><div class="ttdef"><b>Definition</b> deliver.cpp:13</div></div>
<div class="ttc" id="aclass_deliver_html_a6b65097be32fcf618eac00f4aeaac818"><div class="ttname"><a href="class_deliver.html#a6b65097be32fcf618eac00f4aeaac818">Deliver::cond</a></div><div class="ttdeci">std::condition_variable * cond()</div><div class="ttdoc">获取条件变量。</div><div class="ttdef"><b>Definition</b> deliver.cpp:58</div></div>
<div class="ttc" id="aclass_deliver_html_a7bffed391626bd10d14c1bfad8d9e64e"><div class="ttname"><a href="class_deliver.html#a7bffed391626bd10d14c1bfad8d9e64e">Deliver::Deliver</a></div><div class="ttdeci">Deliver(const std::string &amp;app_name, const std::string &amp;sub_name, const char *data, int size, int flag)</div><div class="ttdoc">构造函数，初始化Deliver对象。</div><div class="ttdef"><b>Definition</b> deliver.cpp:4</div></div>
<div class="ttc" id="aclass_deliver_html_a849c168dc7ff635842a2ef36f6d9d922"><div class="ttname"><a href="class_deliver.html#a849c168dc7ff635842a2ef36f6d9d922">Deliver::mutex</a></div><div class="ttdeci">std::mutex * mutex()</div><div class="ttdoc">获取互斥锁。</div><div class="ttdef"><b>Definition</b> deliver.cpp:53</div></div>
<div class="ttc" id="aclass_deliver_html_a8fd1e1719e6f4784c6895e7762ac9002"><div class="ttname"><a href="class_deliver.html#a8fd1e1719e6f4784c6895e7762ac9002">Deliver::setReplied</a></div><div class="ttdeci">void setReplied(bool replied)</div><div class="ttdoc">设置回复状态。</div><div class="ttdef"><b>Definition</b> deliver.cpp:48</div></div>
<div class="ttc" id="aclass_deliver_html_aad55d2243e358a5d397d7e3aff55c3db"><div class="ttname"><a href="class_deliver.html#aad55d2243e358a5d397d7e3aff55c3db">Deliver::isReplied</a></div><div class="ttdeci">bool isReplied()</div><div class="ttdoc">检查是否已回复。</div><div class="ttdef"><b>Definition</b> deliver.cpp:43</div></div>
<div class="ttc" id="aclass_deliver_html_ab5ed5090feebd3f79364f7af311b5ea4"><div class="ttname"><a href="class_deliver.html#ab5ed5090feebd3f79364f7af311b5ea4">Deliver::data</a></div><div class="ttdeci">const char * data() const</div><div class="ttdoc">获取数据指针。</div><div class="ttdef"><b>Definition</b> deliver.cpp:23</div></div>
<div class="ttc" id="aclass_deliver_html_ac015d1cb31e71cb00732af2d683ff765"><div class="ttname"><a href="class_deliver.html#ac015d1cb31e71cb00732af2d683ff765">Deliver::~Deliver</a></div><div class="ttdeci">virtual ~Deliver()</div><div class="ttdoc">析构函数，释放Deliver对象。</div><div class="ttdef"><b>Definition</b> deliver.cpp:9</div></div>
<div class="ttc" id="aclass_deliver_html_ac38bf2ecd3e5e067eba29ee1e7bb7a26"><div class="ttname"><a href="class_deliver.html#ac38bf2ecd3e5e067eba29ee1e7bb7a26">Deliver::size</a></div><div class="ttdeci">int size() const</div><div class="ttdoc">获取数据大小。</div><div class="ttdef"><b>Definition</b> deliver.cpp:28</div></div>
<div class="ttc" id="anamespace_f_l_a_g_html"><div class="ttname"><a href="namespace_f_l_a_g.html">FLAG</a></div><div class="ttdoc">命名空间FLAG用于封装与通信相关的常量</div></div>
<div class="ttc" id="anamespace_f_l_a_g_html_a0fd6e9f0f6df94ff81429d14418c7e83"><div class="ttname"><a href="namespace_f_l_a_g.html#a0fd6e9f0f6df94ff81429d14418c7e83">FLAG::SendAndReceived</a></div><div class="ttdeci">const int SendAndReceived</div><div class="ttdoc">发送和接收数据的标志</div><div class="ttdef"><b>Definition</b> deliver.h:22</div></div>
<div class="ttc" id="anamespace_f_l_a_g_html_a4ed97ba12503ee6570c585e5df503c1d"><div class="ttname"><a href="namespace_f_l_a_g.html#a4ed97ba12503ee6570c585e5df503c1d">FLAG::OnlySend</a></div><div class="ttdeci">const int OnlySend</div><div class="ttdoc">仅发送数据的标志</div><div class="ttdef"><b>Definition</b> deliver.h:17</div></div>
<div class="ttc" id="astruct_reply_html"><div class="ttname"><a href="struct_reply.html">Reply</a></div><div class="ttdoc">结构体，用于存储回复的数据和大小。</div><div class="ttdef"><b>Definition</b> deliver.h:30</div></div>
<div class="ttc" id="astruct_reply_html_acbc2644b460b9a5bf39aaf7f7b54830d"><div class="ttname"><a href="struct_reply.html#acbc2644b460b9a5bf39aaf7f7b54830d">Reply::size</a></div><div class="ttdeci">int size</div><div class="ttdoc">回复的数据大小</div><div class="ttdef"><b>Definition</b> deliver.h:32</div></div>
<div class="ttc" id="astruct_reply_html_ad8ffcb6b7adb181557c1030fa0d8d6b0"><div class="ttname"><a href="struct_reply.html#ad8ffcb6b7adb181557c1030fa0d8d6b0">Reply::data</a></div><div class="ttdeci">const char * data</div><div class="ttdoc">回复的数据指针</div><div class="ttdef"><b>Definition</b> deliver.h:31</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
